package com.deer.remote.server.rds.controller;

import com.deer.remote.common.protocol.Message;
import com.deer.remote.common.protocol.Packet;
import com.deer.remote.server.rds.BaseMessageController;
import com.deer.remote.server.rds.TentacleDesktopSession;

/**
 * Created by matrixy on 2019/1/4. 转发屏幕快照到websocket会话
 */
public class ScreenshotController extends BaseMessageController {
	@Override
	public boolean authenticateRequired() {
		return true;
	}

	@Override
	public Message service(TentacleDesktopSession session, Message msg) throws Exception {
		Packet packet = msg.getBody();
		int width = packet.nextShort();
		int height = packet.nextShort();
		long captureTime = packet.nextLong();
		int sequence = packet.nextInt();
		session.getWebsocketContext().sendScreenshot(packet.getBytes());
		return null;
	}
}
